#pragma once

#include <mutex>
#include <thread>
#include <condition_variable>
#include <vector>
#include <memory>
#include <map>


class EventLoop;
class EventLoopThread;

class EventLoopThreadPool 
{
 public:
  EventLoopThreadPool(EventLoop* baseLoop);
  ~EventLoopThreadPool();
  void setThreadNum(int numThreads) { numThreads_ = numThreads; }
  void start();
  EventLoop* getNextLoop();

 private:
  EventLoop* baseLoop_;
  bool started_;
  int numThreads_;
  int next_;  // always in loop thread
  
  std::vector<std::shared_ptr<EventLoopThread>> threads_;
  std::vector<EventLoop*> loops_;

};
